/*
 * tim.h
 *
 *  Created on: 2025年3月29日
 *      Author: ceeu
 */

#ifndef TIM_H_
#define TIM_H_

/* Private includes ----------------------------------------------------------*/
#include "cpu.h"

/* Private typedef -----------------------------------------------------------*/
typedef struct {
    unsigned char b0 : 1;
    unsigned char b1 : 1;
    unsigned char b2 : 1;
    unsigned char b3 : 1;
    unsigned char b4 : 1;
    unsigned char b5 : 1;
    unsigned char b6 : 1;
    unsigned char b7 : 1;
} _FLAG_bits;

typedef union {
    _FLAG_bits    bits;
    unsigned char byte;
} _TKS_FLAGA_type;

/* Private define ------------------------------------------------------------*/
extern _TKS_FLAGA_type bitFlag;
#define BIT_1MSF   bitFlag.bits.b3
#define BIT_10MSF  bitFlag.bits.b4
#define BIT_50MSF  bitFlag.bits.b5
#define BIT_100MSF bitFlag.bits.b6
#define BIT_500MSF bitFlag.bits.b7

extern _TKS_FLAGA_type TKS_FLAGA;
#define TKS_1MSF   TKS_FLAGA.bits.b3
#define TKS_10MSF  TKS_FLAGA.bits.b4
#define TKS_50MSF  TKS_FLAGA.bits.b5
#define TKS_100MSF TKS_FLAGA.bits.b6
#define TKS_500MSF TKS_FLAGA.bits.b7

/* Private macro -------------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/
extern uint8_t ftm0Flag;
/* Private function prototypes -----------------------------------------------*/
void timerFlagOpt(void);
void timInit(void);
/* Private user code ---------------------------------------------------------*/

#endif /* TIM_H_ */
